package com.guigu.www.mapper;

import com.guigu.www.pojo.ChatTable;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author DengHao
 * @since 2021-10-31
 */
public interface ChatTableMapper extends BaseMapper<ChatTable> {

    // 邓浩添加 用来查当前健康师有新消息的聊天对象集合
    @Select("SELECT ct.* FROM chat_table ct, consult_messages cm WHERE \n" +
            "ct.`chat_ta_id`=cm.`chat_ta_id` AND con_mes_hm_watch=0 \n" +
            "AND ct.`hm_id` = #{hmId} GROUP BY ct.`chat_ta_id` " +
            "ORDER BY chat_ta_create_time DESC")
    List<ChatTable> queryByHmIdChatList(@Param("hmId") Integer hmId);
}
